import type { CodeType, User, UserInfo } from "@/types/user"
import { request } from "@/utils/requst"
// 密码登录
export const loginByPassword = (mobile: string, password: string) => {
  return request<User>('/login/password', 'post', { mobile, password })
}

// 获取验证码
export const sendMobileCode = (mobile: string, type: CodeType) =>
  request<{code: string}>('/code', 'get', {mobile, type})

// 验证码登录
export const loginBySecurity = (module: string, code: string) => 
  request<User>('/login', 'post', { module, code })

// 获取用户详细信息
export const getUserInfo = () =>
  request<UserInfo>('/patient/myUser', 'get')